//
//  WJBaseTableViewCell.m
//  WJBSApp
//
//  Created by dllo on 16/7/13.
//  Copyright © 2016年 王景伟. All rights reserved.
//

#import "WJBaseTableViewCell.h"

@implementation WJBaseTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"]) {
        self.contentView.backgroundColor = FORBLACKCOLOR;
    } else {
        self.contentView.backgroundColor = BSWhiteColor;
    }
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    return self;
}

- (void)changeColor:(NSNotification *)cation {
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"]) {
        self.contentView.backgroundColor = FORBLACKCOLOR;
    } else {
        self.contentView.backgroundColor = BSWhiteColor;
    }
}

// 销毁观察者
- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
